{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑房源</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">
                        <input type="hidden" name="id" value="{$info['h_id']}">

                        {if $info['h_type']!=1}
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">价格：</label>
                            <div class="layui-input-block">
                                <input type="text" name="h_price"  value="{$info['h_price']?$info['h_price']:''}" lay-verify="required"  class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">首付比例：</label>
                            <div class="layui-input-block">
                                <input type="text" name="h_first"  value="{$info['h_first']?$info['h_first']:''}" lay-verify="required"  class="layui-input ">
                            </div>
                        </div>
                        {/if}
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">房屋标题：</label>
                            <div class="layui-input-block">
                                <input type="text" name="h_title"  value="{$info['h_title']}" lay-verify="required"  class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">联系方式：</label>
                            <div class="layui-input-block">
                                <input type="text" name="h_contact"  value="{$info['h_contact']}" lay-verify="required"  class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">所在省市区：</label>
                            <div class="layui-input-block">
                                <input type="text" name="h_sheng"  value="{$info['sheng']}{$info['shi']}{$info['qu']}" readonly class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">所属小区：</label>
                            <div class="layui-input-block">
                                <select name="h_fix" lay-search="">
                                    <option  value="">请选择小区</option>
                                    {volist name='diss' id='di'}
                                    <option  value="{$di['dis_id']}" {if $di['dis_id']==$info['h_dis_id']} selected {/if}>{$di.dis_name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10">
                            <label class="layui-form-label">面积：</label>
                            <div class="layui-input-block">
                                <input type="text" name="h_mianji"  value="{$info['h_mianji']}" lay-verify="required"  class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">装修：</label>
                            <div class="layui-input-block">
                                <select name="h_fix" lay-search="">
                                    <option  value="1"{if $info['h_fix']==1} selected {/if}>简装</option>
                                    <option  value="2"{if $info['h_fix']==2} selected {/if}>中装</option>
                                    <option  value="3"{if $info['h_fix']==3} selected {/if}>精装</option>
                                    <option  value="4"{if $info['h_fix']==4} selected {/if}>毛坯</option>
                                </select>
                            </div>
                        </div>
                        {if $info['h_type']!=1}
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">税费：</label>
                            <div class="layui-input-block">
                                <select name="h_shui" lay-search="">
                                    <option  value="1" {if $info['h_shui']==1} selected {/if}>满2年</option>
                                    <option  value="2" {if $info['h_shui']==2} selected {/if}>满5年</option>
                                    <option  value="3" {if $info['h_shui']==3} selected {/if}>不满2年</option>
                                </select>
                            </div>
                        </div>
                        {/if}
                        {if $info['h_type']==1}
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">看房时间：</label>
                            <div class="layui-input-block">
                                <select name="h_kan" lay-search="">
                                    <option  value="1"{if $info['h_kan']==1} selected {/if}>随时看房</option>
                                    <option  value="2"{if $info['h_kan']==2} selected {/if}>电话预约</option>
                                    <option  value="3"{if $info['h_kan']==3} selected {/if}>休息日</option>
                                </select>
                            </div>
                        </div>
                        {/if}
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">户型：</label>
                            <div class="layui-input-block layui-col-md2"style="margin-left:50px">
                                <select name="h_shis" lay-search="">
                                    <option  value="1" {if $info['h_shis']==1} selected {/if}>1室</option>
                                    <option  value="2" {if $info['h_shis']==2} selected {/if}>2室</option>
                                    <option  value="3" {if $info['h_shis']==3} selected {/if}>3室</option>
                                    <option  value="4" {if $info['h_shis']==4} selected {/if}>4室</option>
                                    <option  value="5" {if $info['h_shis']==5} selected {/if}>5室</option>
                                    <option  value="6" {if $info['h_shis']==6} selected {/if}>以上</option>
                                </select>
                            </div>
                            <div class="layui-input-block layui-col-md2" style="margin-left:50px">
                                <select name="h_tings" lay-search="">
                                    <option  value="0"{if $info['h_tings']==0} selected {/if}>0厅</option>
                                    <option  value="1"{if $info['h_tings']==1} selected {/if}>1厅</option>
                                    <option  value="2"{if $info['h_tings']==2} selected {/if}>2厅</option>
                                    <option  value="3"{if $info['h_tings']==3} selected {/if}>3厅</option>
                                    <option  value="4"{if $info['h_tings']==4} selected {/if}>4厅</option>
                                    <option  value="6"{if $info['h_tings']==6} selected {/if}>以上</option>
                                </select>
                            </div>
                            <div class="layui-input-block layui-col-md2" style="margin-left:50px">
                                <select name="h_weis" lay-search="">
                                    <option  value="0"{if $info['h_weis']==0} selected {/if}>0卫</option>
                                    <option  value="1"{if $info['h_weis']==1} selected {/if}>1卫</option>
                                    <option  value="2" {if $info['h_weis']==2} selected {/if}>2卫</option>
                                    <option  value="3" {if $info['h_weis']==3} selected {/if}>3卫</option>
                                    <option  value="4" {if $info['h_weis']==4} selected {/if}>4卫</option>
                                    <option  value="6" {if $info['h_weis']==6} selected {/if}>以上</option>
                                </select>
                            </div>

                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">标签：</label>
                            {if $info['h_type']==1}
                            <div class="layui-input-block" >
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="短租" value="10" {if in_array(10,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="拎包入住" value="11"{if in_array(11,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="精装修" value="12"{if in_array(12,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="配套完善" value="13"{if in_array(13,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="可供暖" value="14"{if in_array(14,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="停车方便" value="15"{if in_array(15,$info['h_signs'])} checked {/if}>
                            </div>
                            {/if}
                            {if $info['h_type']==2||$info['h_type']==3}
                            <div class="layui-input-block" >
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="免税" value="1"{if in_array(1,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="精装" value="2"{if in_array(2,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="学区房" value="3"{if in_array(3,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="配套完善" value="4"{if in_array(4,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="低首付" value="5"{if in_array(5,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="方便停车" value="6"{if in_array(6,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="环境优美" value="7"{if in_array(7,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="急售" value="8"{if in_array(8,$info['h_signs'])} checked {/if}>
                                <input type="checkbox" name="h_sign[]" lay-skin="primary" title="婚房" value="9"{if in_array(9,$info['h_signs'])} checked {/if}>
                            </div>
                            {/if}
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">楼层：</label>
                            <div class="layui-input-block">
                                <input type="text" name="h_floor"  value="{$info['h_floor']}" lay-verify="required"  class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">房屋介绍：</label>
                            <div class="layui-input-block">
                                <textarea name="h_jianjie"   style="width:380px;height:200px" lay-verify="required"  class="layui-input ">{$info['h_jianjie']}</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
//    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
//            data.field.content = editor.txt.html();
            $.ajax({
                url:"{:url('update')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('House/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>
</body>
</html>
